javascript | 您所在的位置:网站首页 › ANY Attachments API 117 22 › javascript |
You need to $select and $expand the AttachmentFiles property for your list items if you want to select many items from the list. _api/lists/getByTitle('MyList')/items?$select=AttachmentFiles,Title&$expand=AttachmentFilesThen you can get attachment info (if it exists) in the AttachmentFiles property of your list item which will be an array of AttachmentFile objects. I suggest you just check out the return values in your dev tools to inspect the structure with something like: $.getJSON("/_api/lists/getByTitle('MyList')/items?$select=AttachmentFiles,Title&$expand=AttachmentFiles", function(data) { console.log(data) })But you can do something like retrieve the file's URL with: data.value[0].AttachmentFiles[0].ServerRelativeUrlIf your list item doesn't have any attachments, the AttachmentFiles will be an empty array. I can't seem to get the $filter operator to work with the Attachments property to filter the results for only those items with attachments -- maybe someone else out there has some experience getting that up and running and would like to add it here =) |
CopyRight 2018-2019 实验室设备网 版权所有 |